<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/3/20
 * Time: 18:13
 */
namespace app\index\model;

use think\Model;

class Api extends Model
{
    // status属性读取器
    protected function getStatusAttr($value)
    {
        $status = [ 0 => '禁用', 1 => '启用'];
        return $status[$value];
    }

    protected function getRequestAttr($value)
    {
        $request = [ 0 => '全部', 1 => 'GET', 2 => 'POST'];
        return $request[$value];
    }

    public function params()
    {
        return $this->hasMany('Param','id','api_id');
    }

}